﻿/*
Copyright � Edward Nutting 2013
Author: Edward Nutting 
Date: Jul 8 18:31 2013

URL: https://typescriptui.codeplex.com/
Modifications:
 - 8/Jul/13 : Initial version.

License: https://typescriptui.codeplex.com/license
*/

/// <reference path="../Interfaces/IButton.d.ts" />
/// <reference path="Label.ts" />
/// <reference path="Control.ts" />

module TSUI.UI
{
    export class Button extends Control implements IButton
    {
        TextLabel: ILabel;

        constructor()
        {
            super();

            this._rootElement.addClass("Button");

            this.TextLabel = new Label();
            this.Children.Add(this.TextLabel);

            this.Focusable(true);
        }

        Text(value: string = null): string
        {
            return this.TextLabel.Text(value);
        }

        InvokeDefaultAction(): void
        {
            this._rootElement.click();
        }
    }
}